package com.dyh.quickdemo.stub;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.slf4j.helpers.FormattingTuple;
import org.slf4j.helpers.Util;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

/*
@Author=Joey Wheeler
@Date=2021/4/14 16:15
*/
@Slf4j
public class TestStub {

    @Test
    public void test(){

        System.out.println(fun(0));
    }

     int fun(int d){
        long orderId = 11;
        Stub stub = new Stub(orderId);
        stub.addTag("presale");
        stub.addTag("cancle");
        try {
            stub.log("warehouseId 1");
            int t = 1/d;
            stub.log("error ");
            stub.log("dawd={}",113.11);
            return 0;
        } catch (Exception e) {
            log.error("e=",e);
            stub.log("error={}",e);
            return 1;
        }
        finally {
            log.info("report={}",stub.getReport());
        }
    }


    @Test
    public void tes2t(){
//        StringBuilder sb = new StringBuilder();
        StringBuilder sb=new StringBuilder();
        sb.append("1");
        String n = null;
        sb.append(Optional.ofNullable(n).orElse(""));


        System.out.println(sb.length());
    }

}
